import { Provide } from '@midwayjs/core';
import { BaseService } from '@cool-midway/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
import { StudentPrescriptionEntity } from '../entity/prescription';

/**
 * 处方服务
 */
@Provide()
export class StudentPrescriptionService extends BaseService {
  @InjectEntityModel(StudentPrescriptionEntity)
  studentPrescriptionEntity: Repository<StudentPrescriptionEntity>;

  // 重写list方法
  async list(param) {
    const list = await this.studentPrescriptionEntity.find({
      where: {
        appointmentId: param.appointmentId,
      }
    });
    // console.log('list', param, param.appointmentId, list)
    return list;
  }
}
